package classes;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SpinAdapterGenerico extends ArrayAdapter<ArrayGenerico>{

    private Context context;
    private ArrayGenerico[] values;

    public SpinAdapterGenerico(Context context, int textViewResourceId,
    		ArrayGenerico[] pessoas) {
        super(context, textViewResourceId, pessoas);
        this.context = context;
        this.values = pessoas;
    }

    public int getCount(){
       return values.length;
    }

    public ArrayGenerico getItem(int position){
       return values[position];
    }

    public long getItemId(int position){
       return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        TextView label = new TextView(context);
        label.setTextColor(Color.BLACK);

        label.setText(values[position].getLabel());

        return label;
    }

    public View getDropDownView(int position, View convertView,
            ViewGroup parent) {
        TextView label = new TextView(context);
        label.setTextColor(Color.BLACK);
        label.setText(values[position].getLabel());

        return label;
    }
}